<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;

$this->title = '用户登录';
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
    .drt{ background:#fff; padding:45px;}
    .drt p{ margin-bottom:25px;}
    .drt p .user{ background:url(../../images/userpic.png) no-repeat 20px center;}
    .drt p .passw{ background:url(../../images/passpic.png) no-repeat 20px center;}
    .drt p input{ border:1px solid #e5e5e5; width:300px; height:50px; line-height:50px; border-radius:5px; padding-left:50px;}
    .drt p img{float: right;padding: 8px;border: 1px solid #e5e5e5; width:115px; border-radius:5px; height:35px;}
    .drt p .tijiao{ padding:0; text-align:center; color:#fff; background:#faa600; border:none; font-size:18px;width: 100%;}
    .drt p .d{background:url(../../images/userpic1.png) no-repeat 20px center; border:1px solid #af2d30;}
    .drt p .e{background:url(../../images/passpic1.png) no-repeat 20px center; border:1px solid #af2d30;}
    .drt div{ font-size:14px; color:#616161; margin-bottom:20px;}
    .drt p .a{ border:1px solid #af2d30;}



</style>
<form class="registerform" action="<?= yii\helpers\Url::to(['auth/login']);?>" id="subform" method='post'>
    <input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
<div id="Content" style="background:#f7f7f7;">
    <div class="w1113" style="padding:75px 0">
        <div class="Left">
            <img style="width:650px;" src="../../images/denglubg.jpg">
        </div>
        <div class="Right drt">
            <p>
                <a style="color:red">
                    <?php
                    if(\Yii::$app->getSession()->getFlash("error"))
                    {
                        echo \Yii::$app->getSession()->getFlash("error");
                    }
                    ?>
                </a>
            </p>
            <p><input id="user" class="user" name="LoginForm[username]" placeholder="请输入用户名" type="text"></p>
            <p><input id="passw" class="passw"  name="LoginForm[password]" placeholder="请输入密码" type="text"></p>
            <?php if($yanzhengma){ ?>
            <p>
                <input style="width:130px;" name="LoginForm[verifyCode]" placeholder="请输入验证码" id="yan" class="a" type="text">
                <?= Captcha::widget(['name'=>'code','captchaAction'=>'auth/captcha','imageOptions'=>['id'=>'login_code', 'title'=>'换一个', 'alt'=>'换一个'],'template'=>'{image}']);?>
            </p>
            <?php }?>
            <p><input id="tijiao" class="tijiao" value="登 录" type="submit"></p>
            <div><input type="checkbox" style="float:left; margin-top:5px; margin-right:10px;"> 自动登录 <a href="#" style="float:right; font-size:14px; color:#ff5c00;">忘记密码?</a></div>
            <div style="margin-bottom:0"><img src="../../images/deimg.jpg"></div>
        </div>
        <div style="clear:both"></div>
    </div>
</div>
</form>

<script>
    $(document).ready(function(e) {


        $("#user").focus(function(){
            $("#user").addClass("d")
        })
        $("#user").blur(function(){
            if($("#user").val()==""){$("#user").removeClass("d")}
        })


        $("#passw").focus(function(){
            $("#passw").addClass("e")
        })

        $("#passw").blur(function(){

            if($("#passw").val()==""){$("#passw").removeClass("e")}


        })

        $("#yan").focus(function(){
            $("#yan").addClass("a")
        })

        $("#yan").blur(function(){

            if($("#yan").val()==""){$("#yan").removeClass("a")}


        })

        $("#tijiao").click(function(){
            var hasChk = $('#tiao').is(':checked');
            if($("#user").val()==""){
                alert("请输入用户名！");
                return false;
            }

            if($("#passw").val()==""){
                alert("请输入密码！");
                return false;
            }

//            if($("#yan").val()==""){
//                alert("请输入验证码！");
//                return false;
//            }



        })
    });
</script>
